package sample.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Map;

public class RabbitDynamicReceiver {
    public static final Logger log= LoggerFactory.getLogger(RabbitDynamicReceiver.class);
    private ArrayList<String> dynamicQueues;

    public  ArrayList<String> getDynamicQueues() {
        return dynamicQueues;
    }

    public void setDynamicQueues(final  ArrayList<String> pDynamicQueues) {
        dynamicQueues = pDynamicQueues;
    }

    @RabbitListener(queues = "#{rabbitDynamicReceiver.dynamicQueues}")
    public void processAll(Map<String, String> testMessage) {
        System.out.println("processAll  : " + testMessage.toString());
        log.error("processAll  : " + testMessage.toString());
    }
}